<?php

namespace App\Http\Requests;

use App\Models\Users\UserInfo;
use Illuminate\Foundation\Auth\User;
use Illuminate\Foundation\Http\FormRequest;

class UserInfoRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'real_name' => 'required',
            'id_card'   => 'required|unique:user_info'
        ];
    }

    /**
     * Get the error messages for the defined validation rules.
     *
     * @return array
     */
    public function messages()
    {
        return [

        ];
    }

    /**
     * Get custom attributes for validator errors.
     *
     * @return array
     */
    public function attributes()
    {
        $M   = new UserInfo();
        $arr = $M->getRequestAttributes ();

        return is_array ($arr) ? $arr : [];
    }
}
